package li.com.springaidemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import li.com.springaidemo.pojo.Cron;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CronMapper extends BaseMapper<Cron> {
    @Select("select time from cron where id=${id} and state!=0")
    public String getCron(Integer id);

    @Select("select id from cron where state!=0 and id!=0")
    public List<Integer> getOpenId();

    @Update("update cron set state=1 where id=${id}")
    public void openState(Integer id);

    @Update("update cron set state=0 where id=${id}")
    public void closeState(Integer id);
}
